<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>gvn.util</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css"></link>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">

<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="center">
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="gvn-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar" align="right" width="100%">
      <table border="0" cellpadding="0" cellspacing="0">
      <tr><th class="navbar" align="center">
        <p class="nomargin">
          <a class="navbar" target="_top" href="http://code.google.com/p/gvn/">Project&nbsp;Homepage</a>
      </p></th></tr></table>
    </th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <font size="-1"><b class="breadcrumbs">
        <a href="gvn-module.html">Package&nbsp;gvn</a> ::
        Module&nbsp;util
      </b></font></br>
    </td>
    <td><table cellpadding="0" cellspacing="0">
      <tr><td align="right"><font size="-2">[<a href="../private/gvn.util-module.html">show&nbsp;private</a>&nbsp;|&nbsp;hide&nbsp;private]</font></td></tr>
      <tr><td align="right"><font size="-2">[<a href="frames.html"target="_top">frames</a>&nbsp;|&nbsp;<a href="gvn.util-module.html" target="_top">no&nbsp;frames</a>]</font></td></tr>
    </table></td>
</tr></table>

<!-- =========== START OF MODULE DESCRIPTION =========== -->
<h2 class="module">Module gvn.util</h2>

<p>Utility routines used throughout the 'gvn' wrapper.</p>
Note that all path manipulations assume Unix-style paths, as expected 
by internal classes. This means that they can't use os.path methods, in 
case we're actually on Windows!
<hr/>

<!-- =========== START OF CLASSES =========== -->
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="summary">
  <th colspan="2">Classes</th></tr>
<tr><td width="15%">
  <b><a href="gvn.util.BoolProperty-class.html"><code>BoolProperty</code></a></b></td>
  <td>&nbsp;</td></tr>
<tr><td width="15%">
  <b><a href="gvn.util.Editor-class.html"><code>Editor</code></a></b></td>
  <td>Interface to a platform-specific editor</td></tr>
<tr><td width="15%">
  <b><a href="gvn.util.ListDict-class.html"><code>ListDict</code></a></b></td>
  <td>Dictionary of lists.</td></tr>
</table><br />


<!-- =========== START OF FUNCTION SUMMARY =========== -->
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="summary">
  <th colspan="2">Function Summary</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><a name="APR_TO_OS_ERROR"></a><span class="summary-sig"><span class="summary-sig-name">APR_TO_OS_ERROR</span>(<span class=summary-sig-arg>e</span>)</span></code>
</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="gvn.util-module.html#ClimbAndFind" class="summary-sig-name"><code>ClimbAndFind</code></a>(<span class=summary-sig-arg>path</span>,
          <span class=summary-sig-arg>test</span>)</span></code>
<br />
Work up the directory tree from the given path, calling test(path)
until test returns either 0 or 1.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="gvn.util-module.html#CommonPrefix" class="summary-sig-name"><code>CommonPrefix</code></a>(<span class=summary-sig-arg>paths</span>,
          <span class=summary-sig-arg>uniform</span>)</span></code>
<br />
Return the longest common leading component of paths.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="gvn.util-module.html#ConstructChangeName" class="summary-sig-name"><code>ConstructChangeName</code></a>(<span class=summary-sig-arg>username</span>,
          <span class=summary-sig-arg>branchname</span>,
          <span class=summary-sig-arg>revision</span>)</span></code>
<br />
Return a valid change name identifier.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="gvn.util-module.html#ConvertStringDateToDateTime" class="summary-sig-name"><code>ConvertStringDateToDateTime</code></a>(<span class=summary-sig-arg>date</span>)</span></code>
<br />
Convert a string date in the svn standard format into a 
datetime.datetime object, to 1-second precision.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="gvn.util-module.html#IsChild" class="summary-sig-name"><code>IsChild</code></a>(<span class=summary-sig-arg>child</span>,
          <span class=summary-sig-arg>parent</span>)</span></code>
<br />
Return True if child is parent (a directory) or is a path under 
parent.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="gvn.util-module.html#IsValidChangeName" class="summary-sig-name"><code>IsValidChangeName</code></a>(<span class=summary-sig-arg>change_name</span>)</span></code>
<br />
A convenience function so callers don't have to try/except.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="gvn.util-module.html#MatchRevision" class="summary-sig-name"><code>MatchRevision</code></a>(<span class=summary-sig-arg>word</span>)</span></code>
<br />
Match word against an svn revision pattern.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="gvn.util-module.html#ParseChangeName" class="summary-sig-name"><code>ParseChangeName</code></a>(<span class=summary-sig-arg>change_name</span>)</span></code>
<br />
Parse a change_name into useful constituent parts.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="gvn.util-module.html#PathSplit" class="summary-sig-name"><code>PathSplit</code></a>(<span class=summary-sig-arg>path</span>,
          <span class=summary-sig-arg>maxsplit</span>,
          <span class=summary-sig-arg>uniform</span>)</span></code>
<br />
Return list of components of path, like str.split not os.path.split 
.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><a name="Prompt"></a><span class="summary-sig"><span class="summary-sig-name">Prompt</span>(<span class=summary-sig-arg>prompt_string</span>)</span></code>
</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="gvn.util-module.html#RelativePath" class="summary-sig-name"><code>RelativePath</code></a>(<span class=summary-sig-arg>parent</span>,
          <span class=summary-sig-arg>child</span>)</span></code>
<br />
Return the path of child relative to parent.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="gvn.util-module.html#ValidateChangeName" class="summary-sig-name"><code>ValidateChangeName</code></a>(<span class=summary-sig-arg>change_name</span>)</span></code>
<br />
Validates that a given change name is acceptable.</td></tr>
</table><br />


<!-- =========== START OF FUNCTION DETAILS =========== -->
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="details">
  <th colspan="2">Function Details</th></tr>
</table>

<a name="ClimbAndFind"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">ClimbAndFind</span>(<span class=sig-arg>path</span>,
          <span class=sig-arg>test</span>)</span>
  </h3>
<pre class="literalblock">
Work up the directory tree from the given path, calling test(path)
until test returns either 0 or 1.  If test(X) returns 0, return X.  If
test(X) returns 1, return the previous directory (one deeper than X).
Return '/' if the path is exhausted without test() ever returning 0 or 1.

Examples:
  test(/path/to/foo/bar)  returns -1 =&gt; call test(/path/to/foo)
  test(/path/to/foo)      returns -1 =&gt; call test(/path/to)
  test(/path/to)          returns 0  =&gt; return /path/to
  test(/path/to)          returns 1  =&gt; return /path/to/foo
</pre>
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="CommonPrefix"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">CommonPrefix</span>(<span class=sig-arg>paths</span>,
          <span class=sig-arg>uniform</span>=<span class=sig-default>True</span>)</span>
  </h3>
  <p>Return the longest common leading component of paths.</p>
  paths must be:
  <ul>
    <li>
      all absolute or all relative, not mixed
    </li>
    <li>
      normal form (no doubled or trailing / characters)
    </li>
  </ul>
  <p>Otherwise the result is undefined.</p>
  <p>You might think we've reinvented os.path.commonprefix . You'd be 
  wrong: &gt;&gt;&gt; os.path.commonprefix(['/tmp/ab', '/tmp/ac']) 
  '/tmp/a'</p>
  <p>This brokenness is actually documented in the HTML help, but not in 
  the doc string.</p>
  Arguments: paths -- list of paths uniform -- whether to use / or 
  system-specific separator (default True)
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="ConstructChangeName"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">ConstructChangeName</span>(<span class=sig-arg>username</span>,
          <span class=sig-arg>branchname</span>,
          <span class=sig-arg>revision</span>=<span class=sig-default>None</span>)</span>
  </h3>
  <p>Return a valid change name identifier.</p>
  If revision is not specified then HEAD is assumed.
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="ConvertStringDateToDateTime"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">ConvertStringDateToDateTime</span>(<span class=sig-arg>date</span>)</span>
  </h3>
  Convert a string date in the svn standard format into a 
  datetime.datetime object, to 1-second precision.
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="IsChild"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">IsChild</span>(<span class=sig-arg>child</span>,
          <span class=sig-arg>parent</span>)</span>
  </h3>
  Return True if child is parent (a directory) or is a path under 
  parent.
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="IsValidChangeName"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">IsValidChangeName</span>(<span class=sig-arg>change_name</span>)</span>
  </h3>
  A convenience function so callers don't have to try/except.
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="MatchRevision"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">MatchRevision</span>(<span class=sig-arg>word</span>)</span>
  </h3>
  <p>Match word against an svn revision pattern.</p>
  Returns the revision number (sub)string of word if present otherwise 
  None.
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="ParseChangeName"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">ParseChangeName</span>(<span class=sig-arg>change_name</span>)</span>
  </h3>
<pre class="literalblock">
Parse a change_name into useful constituent parts.

Change names are of the form:

  [user/]branchname[&#64;revision]

NOTE: Validation of the branchname is *not* done here.

Returns a tuple of the form (username, branchname, revision).
Any of these can be None to indicate that no such element could be
parsed.
</pre>
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="PathSplit"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">PathSplit</span>(<span class=sig-arg>path</span>,
          <span class=sig-arg>maxsplit</span>=<span class=sig-default>-1</span>,
          <span class=sig-arg>uniform</span>=<span class=sig-default>True</span>)</span>
  </h3>
  <p>Return list of components of path, like str.split not os.path.split 
  .</p>
  <p>path must be normal form (no doubled or trailing / characters)</p>
  Arguments: path -- path to split maxsplit -- do at most maxsplit 
  splits (default full split) uniform -- whether to use / or 
  system-specific separator (default True)
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="RelativePath"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">RelativePath</span>(<span class=sig-arg>parent</span>,
          <span class=sig-arg>child</span>)</span>
  </h3>
  <p>Return the path of child relative to parent.</p>
  <p>If parent is '', simply return child. Else, if child is not a child 
  of parent (e.g. RelativePath('/tmp', '/etc')), raise 
  gvn.errors.PathNotChild. Else, return the relative path (e.g. 
  RelativePath('/tmp/wc', '/tmp/wc/lib' =&gt; 'lib')).</p>
  Raises: gvn.errors.PathNotChild
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="ValidateChangeName"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">ValidateChangeName</span>(<span class=sig-arg>change_name</span>)</span>
  </h3>
  <p>Validates that a given change name is acceptable.</p>
  Raises a ChangeBranch exception if any of the following conditions 
  are not met:
  <ol start="1">
    <li>
      change_name does not conform to VALID_CHANGE_NAME_PAT
    </li>
    <li>
      change_name could be mistaken for a revision number
    </li>
  </ol>
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>
<br />


<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="center">
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="gvn-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar" align="right" width="100%">
      <table border="0" cellpadding="0" cellspacing="0">
      <tr><th class="navbar" align="center">
        <p class="nomargin">
          <a class="navbar" target="_top" href="http://code.google.com/p/gvn/">Project&nbsp;Homepage</a>
      </p></th></tr></table>
    </th>
  </tr>
</table>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td align="left"><font size="-2">Generated by Epydoc 2.1 on Tue Jul 17 16:51:46 2007</font></td>
    <td align="right"><a href="http://epydoc.sourceforge.net"
                      ><font size="-2">http://epydoc.sf.net</font></a></td>
  </tr>
</table>
</body>
</html>
